package com.yearns.kafka.rabbitmq;

import com.yearns.kafka.entity.User;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @author yearns
 * @date 2019/6/28 13:02
 */
@Component
public class RabbitMQReceiver {

    @RabbitListener(queues = RabbitMQConfig.QUEUE)
    public void receiverDirectQueue(User user) {
        System.out.println("Receiver : " + user.toString());
    }

    /**
     * queues是指要监听的队列的名字
     */
    @RabbitListener(queues = RabbitMQConfig.TOPIC_QUEUE1)
    public void receiveTopic1(User user) {
        System.out.println("【receiveTopic1监听到消息】" + user.toString());
    }
    @RabbitListener(queues = RabbitMQConfig.TOPIC_QUEUE2)
    public void receiveTopic2(User user) {
        System.out.println("【receiveTopic2监听到消息】" + user.toString());
    }



    @RabbitListener(queues = RabbitMQConfig.TOPIC_QUEUE3)
    public void receiveTopic3(User user) {
        System.out.println("【receiveTopic3监听到消息】" + user.toString());
    }
    @RabbitListener(queues = RabbitMQConfig.TOPIC_QUEUE4)
    public void receiveTopic4(User user) {
        System.out.println("【receiveTopic4监听到消息】" + user.toString());
    }

}
